const fs = require('fs')

const utils = {
    async uDeleteFile(url) {
        if (fs.existsSync(url)) {
            await fs.unlinkSync(url)
            return true
        } else {
            throw `给定的路径${url}不存在，请给出正确的路径`
        }
    },

    async uMakeDir(url) {
        if (!fs.existsSync(url)) {
            await fs.mkdirSync(url)
        }
        return true
    },

    async uWriteFile(url, content) {
        await fs.writeFileSync('.' + url, content)
        return true
    }

}

module.exports = {
    ...utils
}